package com.piggy.logi.sys.mapper;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.piggy.common.core.web.page.BaseMapperPlus;
import com.piggy.logi.sys.domain.LogiCarrierDriverLine;

import java.util.List;

/**
 * 司机常用线路管理Mapper接口
 *
 * @author piggy
 * @date 2023-08-23
 */
public interface LogiCarrierDriverLineMapper extends BaseMapperPlus<LogiCarrierDriverLine> {

    default List<LogiCarrierDriverLine> selectByDriverIds(List<Long> driverIds, Integer lineType) {
        return selectList(Wrappers.<LogiCarrierDriverLine>lambdaQuery().in(LogiCarrierDriverLine::getCarrierDriverId, driverIds)
                .eq(LogiCarrierDriverLine::getLineType, lineType));
    }

    default void removeByDriverId(Long driverId, Integer lineType) {
        delete(Wrappers.<LogiCarrierDriverLine>lambdaQuery().eq(LogiCarrierDriverLine::getCarrierDriverId, driverId)
                .eq(LogiCarrierDriverLine::getLineType, lineType));
    }
}
